package com.yunpeng.aidevice.dao.model;

import com.yunpeng.aidevice.dao.constant.DictionariesConstant;

import java.time.LocalDateTime;

/**
 * EntityDO 实体表
 *
 * @author : Moore(hemw)
 * @date : 2020-03-26
 */
public abstract class BaseEntityDO extends BaseDO {
    /**
     * 业务主键
     */
    protected String code;

    /**
     * 实体名称
     */
    protected String name;

    /**
     * 租户代码
     */
    protected String tenantCode;

    /**
     * 编号
     */
    protected String number;

    public BaseEntityDO() {
    }

    public BaseEntityDO(Long id, Short flag, String creator, LocalDateTime createTime, String updater, LocalDateTime updateTime, String code, String name, String tenantCode, String number) {
        super(id, flag, creator, createTime, updater, updateTime);
        this.code = code;
        this.name = name;
        this.tenantCode = tenantCode;
        this.number = number;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public String getTenantCode() {
        return tenantCode;
    }

    public void setTenantCode(String tenantCode) {
        this.tenantCode = tenantCode;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }


    @Override
    public String toString() {
        return "BaseDataDO{" +
                "id=" + id +
                ", flag=" + flag +
                ", creator='" + creator + '\'' +
                ", createTime=" + createTime +
                ", updater='" + updater + '\'' +
                ", updateTime=" + updateTime +
                ", code='" + code + '\'' +
                ", name='" + name + '\'' +
                ", number='" + number + '\'' +
                ", tenantCode='" + tenantCode + '\'' +
                "} ";
    }

    @Override
    public void initForNew(String userCode) {
        super.initForNew(userCode);
        this.tenantCode = DictionariesConstant.INSTANCE.getDefaultTenantCode();
    }
}
